﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;

namespace LuoYi.Admin.Entities;

/// <summary>
/// 定时任务调度表
/// </summary>
[PrimaryKey("JobId", "JobName", "JobGroup")]
[Table("sys_job")]
public class SysJob : IEntity
{
    /// <summary>
    /// 任务ID
    /// </summary>
    [Key]
    [Column("job_id", TypeName = "bigint(20)")]
    public long JobId { get; set; }

    /// <summary>
    /// 任务名称
    /// </summary>
    [Key]
    [Column("job_name")]
    [StringLength(64)]
    public string JobName { get; set; } = null!;

    /// <summary>
    /// 任务组名
    /// </summary>
    [Key]
    [Column("job_group")]
    [StringLength(64)]
    public string JobGroup { get; set; } = null!;

    /// <summary>
    /// 调用目标字符串
    /// </summary>
    [Column("invoke_target")]
    [StringLength(500)]
    public string InvokeTarget { get; set; } = null!;

    /// <summary>
    /// cron执行表达式
    /// </summary>
    [Column("cron_expression")]
    [StringLength(255)]
    public string? CronExpression { get; set; }

    /// <summary>
    /// 计划执行错误策略（1立即执行 2执行一次 3放弃执行）
    /// </summary>
    [Column("misfire_policy")]
    [StringLength(20)]
    public string? MisfirePolicy { get; set; }

    /// <summary>
    /// 是否并发执行（0允许 1禁止）
    /// </summary>
    [Column("concurrent")]
    [StringLength(1)]
    public string? Concurrent { get; set; }

    /// <summary>
    /// 状态（0正常 1暂停）
    /// </summary>
    [Column("status")]
    [StringLength(1)]
    public string? Status { get; set; }

    /// <summary>
    /// 创建者
    /// </summary>
    [Column("create_by")]
    [StringLength(64)]
    public string? CreateBy { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [Column("create_time", TypeName = "datetime")]
    public DateTime? CreateTime { get; set; }

    /// <summary>
    /// 更新者
    /// </summary>
    [Column("update_by")]
    [StringLength(64)]
    public string? UpdateBy { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    [Column("update_time", TypeName = "datetime")]
    public DateTime? UpdateTime { get; set; }

    /// <summary>
    /// 备注信息
    /// </summary>
    [Column("remark")]
    [StringLength(500)]
    public string? Remark { get; set; }
}
